﻿<Window x:Class="Coogle.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:loc="clr-namespace:Coogle"
        Title="Coogle"
        MinHeight="800"
        MinWidth="800">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0"
                   FontSize="50"
                   FontWeight="Normal"
                   TextAlignment="Left"
                   Margin="5,0,0,0"
                   TextWrapping="Wrap">
            <Run FontFamily="Franklin Gothic"
                 Foreground="#FF98C61F"
                 Text="COOGLE" />
            <Run FontFamily="Corbel"
                 Foreground="#FF77B6EB"
                 Text="DotNetToscana" />
        </TextBlock>

        <ContentControl Style="{StaticResource MainContent}"
                        Grid.Row="1"
                        Grid.Column="0"
                        IsTabStop="False">
            <ContentControl.Content>
                <Grid>
                    <Grid.Effect>
                        <DropShadowEffect />
                    </Grid.Effect>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="40*" />
                        <RowDefinition Height="60*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="40*" />
                        <ColumnDefinition Width="1.5*" />
                        <ColumnDefinition Width="55*" />
                    </Grid.ColumnDefinitions>

                    <Border Grid.Row="0"
                            Grid.Column="0"
                            Grid.ColumnSpan="3"
                            Style="{StaticResource ModuleContentBorder}">
                        <Grid Margin="2"
                              VerticalAlignment="Stretch"
                              HorizontalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="100" />
                            </Grid.ColumnDefinitions>

                            <TextBox x:Name="txtSearch"
                                     loc:AutoSelectContentBehavior.Enabled="True"
                                     Grid.Row="0"
                                     Grid.Column="0"
                                     FontSize="16"
                                     Height="30"
                                     Margin="3"
                                     KeyDown="txtSearch_KeyDown" />

                            <Button x:Name="btnSearch"
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    FontSize="16"
                                    Height="30"
                                    Margin="3"
                                    Content="_Search"
                                    Click="btnSearch_Click" />
                        </Grid>
                    </Border>
                    <Border Grid.Row="1"
                            Grid.Column="0"
                            x:Name="containerDetails"
                            Visibility="Collapsed"
                            Style="{StaticResource ModuleContentBorder}">
                        <HeaderedContentControl Header="Container"
                                                Margin="2"
                                                Style="{StaticResource ModuleHeader}">
                            <HeaderedContentControl.Content>
                                <Grid>
                                    <Grid.Resources>
                                        <Style TargetType="{x:Type TextBlock}">
                                            <Setter Property="Margin"
                                                    Value="5,5" />
                                            <Setter Property="FontSize"
                                                    Value="18" />
                                            <Setter Property="VerticalAlignment"
                                                    Value="Center" />
                                        </Style>
                                    </Grid.Resources>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="25*" />
                                        <RowDefinition Height="25*" />
                                        <RowDefinition Height="25*" />
                                        <RowDefinition Height="25*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="17*" />
                                        <ColumnDefinition Width="35*" />
                                        <ColumnDefinition Width="50*" />
                                    </Grid.ColumnDefinitions>

                                    <TextBlock Grid.Row="0"
                                               Grid.Column="0"
                                               FontWeight="Bold"
                                               Text="Codice:" />
                                    <TextBlock Grid.Row="1"
                                               Grid.Column="0"
                                               FontWeight="Bold"
                                               Text="Tipo:" />

                                    <TextBlock Grid.Row="0"
                                               Grid.Column="1"
                                               Text="{Binding Code}" />
                                    <TextBlock Grid.Row="1"
                                               Grid.Column="1"
                                               Text="{Binding Type}" />

                                    <Image Grid.Row="0"
                                           Grid.RowSpan="4"
                                           Grid.Column="2"
                                           Height="200"
                                           Source="{Binding Type.Image}" />
                                </Grid>
                            </HeaderedContentControl.Content>
                        </HeaderedContentControl>
                    </Border>
                    <Border Grid.Row="1"
                            Grid.Column="2"
                            Grid.RowSpan="2"
                            x:Name="shippingsList"
                            Visibility="Collapsed"
                            Style="{StaticResource ModuleContentBorder}">
                        <HeaderedContentControl Header="Spedizioni"
                                                Margin="2"
                                                Style="{StaticResource ModuleHeader}">
                            <HeaderedContentControl.Content>
                                <ListBox x:Name="lstShippings"
                                         BorderThickness="0">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Horizontal">
                                                <Border Height="45"
                                                        Width="45"
                                                        CornerRadius="10"
                                                        Margin="10">
                                                    <Border.Style>
                                                        <Style TargetType="{x:Type Border}">
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Type.Descrition}"
                                                                             Value="Exp">
                                                                    <Setter Property="Background"
                                                                            Value="#FF98C61F" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding Type.Descrition}"
                                                                             Value="Imp">
                                                                    <Setter Property="Background"
                                                                            Value="#FF77B6EB" />
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Border.Style>
                                                    <TextBlock FontSize="16"
                                                               VerticalAlignment="Center"
                                                               HorizontalAlignment="Center"
                                                               Margin="5"
                                                               Foreground="White"
                                                               Text="{Binding Type}" />
                                                </Border>
                                                <StackPanel>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBlock FontSize="18"
                                                                   Margin="10,0,0,0"
                                                                   Text="{Binding Port}" />
                                                        <TextBlock FontSize="18"
                                                                   Margin="10,0,0,0"
                                                                   Text=" - " />
                                                        <TextBlock FontSize="18"
                                                                   Margin="10,0,0,0"
                                                                   Text="{Binding Date, StringFormat=g}" />
                                                    </StackPanel>

                                                    <StackPanel Margin="5"
                                                                Orientation="Horizontal">
                                                        <StackPanel.Resources>
                                                            <Style TargetType="{x:Type TextBlock}">
                                                                <Setter Property="Margin"
                                                                        Value="5,5,5,0" />
                                                                <Setter Property="FontSize"
                                                                        Value="14" />
                                                                <Setter Property="VerticalAlignment"
                                                                        Value="Center" />
                                                            </Style>
                                                        </StackPanel.Resources>
                                                        <TextBlock FontWeight="Bold"
                                                                   Text="Nave:" />
                                                        <TextBlock Text="{Binding Ship}" />
                                                        <TextBlock FontWeight="Bold"
                                                                   Text="Peso:" />
                                                        <TextBlock Text="{Binding Weight}" />
                                                        <TextBlock FontWeight="Bold"
                                                                   Text="Sigillo:" />
                                                        <TextBlock Text="{Binding Seal}" />
                                                        <TextBlock FontWeight="Bold"
                                                                   Text="Spedizioniere:" />
                                                        <TextBlock Text="{Binding Forwarder}" />
                                                    </StackPanel>
                                                </StackPanel>
                                            </StackPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </HeaderedContentControl.Content>
                        </HeaderedContentControl>
                    </Border>
                </Grid>
            </ContentControl.Content>
        </ContentControl>
    </Grid>
</Window>